package com.lkpstudy.rbac.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 系统用户
 * @author likaiping
 * @TableName user
 */
@TableName(value ="user")
@Data
public class User implements Serializable {
    /**
     * ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户名
     */
    @NotEmpty(message = "用户名不能为空",
            groups = {Register.class,Edit.class,Plus.class})
    @Size(min = 6,max = 25, message = "用户名长度为6-25",
            groups = {Register.class,Edit.class,Plus.class})
    @Pattern(regexp = "^.*(?=.{6,25})(?=.*\\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?.]).*$",
             message = "用户名必须包含大写字母、小写字母、数字和[!@#$%^&*?.]特殊字符",
            groups = {Register.class,Edit.class,Plus.class})
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 昵称
     */
    @NotEmpty(message = "用户名不能为空",
            groups = {Edit.class,Plus.class})
    @Size(min = 6,max = 25, message = "用户名长度为6-25",
            groups = {Edit.class,Plus.class})
    private String nickname;

    /**
     * 性别：男；女
     */
    @Pattern(regexp = "[男女]", message = "性别只能是男或者女",
            groups = {Register.class,Edit.class,Plus.class})
    private String gender;

    /**
     * 手机号码
     */
    private String phone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 头像地址
     */
    private String avatar_name;

    /**
     * 头像真实路径
     */
    private String avatar_path;

    /**
     * 是否逻辑删除：1-删除；0-未删除
     */
    private Boolean is_deleted;

    /**
     * 状态：1-启用；0-禁用
     */
    private Integer status;

    /**
     * 修改密码的时间
     */
    private Date pwd_reset_time;

    /**
     * 创建者
     */
    private String create_by;

    /**
     * 更新者
     */
    private String update_by;

    /**
     * 创建日期
     */
    private Date create_time;

    /**
     * 更新时间
     */
    private Date update_time;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public interface Register{}
    public interface Edit{}
    public interface Plus{}
}